<?php
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

$env = trim(@file_get_contents(__DIR__ .'/../../release_env'));
//将test1\test2\test3等统一为test环境
define('RELEASE_ENV', $env);
if ($env!='prod' && $env!='beta' && $env!='dev') {
    $env = 'test';
}

//运行环境配置
define('RUNTIME_ENV', $env?$env:'dev');

require(__DIR__ . '/../../protected/vendor/autoload.php');
require(__DIR__ . '/../../protected/vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../protected/common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../protected/common/config/main.php'),
    require(__DIR__ . '/../../protected/common/config/main-local.php'),
    require(__DIR__ . '/../config/main.php')
//    require(__DIR__ . '/../config/main-local.php')
);

if (file_exists(__DIR__ . '/../../protected/common/config/sensitive.php')) {
    $config = yii\helpers\ArrayHelper::merge(
        $config,
        require(__DIR__ . '/../../protected/common/config/sensitive.php')
    );
}

$application = new yii\web\Application($config);
$application->run();
